import QtQuick

Item {
  id: root
  width: 630
  height: 600
  property real xScale: 1
  property real yScale: 1
  property real sign: 1

  property real threshold: 0.07
  property real lungsOpacity: 1
  property real opacityStep: 0.1
  property real opacityL: 0.0

  Timer {
    id: lungsScaler
    running: true
    repeat: true
    interval: 25

    onTriggered: {
      root.xScale += sign * 0.001
      root.yScale += sign * 0.001

      if(root.xScale > 1 + threshold){
        sign = -1;
      }
      if(root.xScale < 1 - threshold){
        sign = 1;
      }
      lungsOpacity = (1 - opacityL) * ((xScale - (1 - threshold))/(2 * threshold)) + opacityL
    }
  }

  Column {
    anchors.fill: parent
    anchors.topMargin: 30
    spacing: 35

    Item {
      width: 602
      height: 212
      Image {
        width: 602
        height: 212
        source: "qrc:///images/static-graph.png"
      }
    }
    Item {
      id: centerfrm
      width: 602
      height: 382
      Image {
        id: img_extraData
        source: "qrc:///images/extra-data.png"
        anchors.top: parent.top
        anchors.topMargin: 10
        anchors.left: centerfrm.left
      }
      Item {
        id: lungpart
        width: 345
        height: 350
        anchors.top: parent.top
        anchors.topMargin: 0
        anchors.left: img_extraData.right
        anchors.leftMargin: 50
        Image {
          id: img_lungC
          source: "qrc:///images/center.png"
          anchors.top: parent.top
          anchors.topMargin: 0
          anchors.horizontalCenter: lungpart.horizontalCenter
        }
        Image {
          id: img_lungL
          source: "qrc:///images/left.png"
          anchors.right: img_lungC.horizontalCenter
          anchors.rightMargin: 20
          anchors.top: img_lungC.top
          anchors.topMargin: 62

          opacity: root.lungsOpacity
          transform: Scale {
            yScale: root.yScale
            xScale: root.xScale
            origin.x: img_lungL.implicitWidth / 2
            origin.y: img_lungL.implicitHeight / 2
          }
        }
        Image {
          id: img_lungR
          source: "qrc:///images/right.png"
          anchors.left: img_lungC.horizontalCenter
          anchors.rightMargin: 20
          anchors.top: img_lungC.top
          anchors.topMargin: 62

          opacity: root.lungsOpacity
          transform: Scale {
            yScale: root.yScale
            xScale: root.xScale
            origin.x: img_lungL.implicitWidth / 2
            origin.y: img_lungL.implicitHeight / 2
          }
        }
      }
      Image {
        id: img_dots
        source: "qrc:///images/change-view.png"
        anchors.top: parent.top; anchors.topMargin: 0
        anchors.right: parent.right; anchors.rightMargin: 20
      }
    }
  }






}
